/**
 * Copyright (c) Software Institute of PKU
 * All rights reserved. 
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 */
package edu.pku.sei.modeler.figures;

import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.Shape;
import org.eclipse.draw2d.ToolbarLayout;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Rectangle;

import edu.pku.notation.runtime.constance.ColorConstance;
import edu.pku.sei.modeler.uml.ResourceFactory;

/**
 * @generated
 * 
 */
public class ActorFigure extends Shape {
	private IFigure stickmanFigure;

	private Label actorNameLabel;

	
	public ActorFigure() {

		super();

		ToolbarLayout layout = new ToolbarLayout();
		this.setLayoutManager(layout);
		layout.setSpacing(2);
		layout.setVertical(true);
		this.setOpaque(true); // non-transparent figure
		//this.setBorder(new LineBorder(ColorConstants.black));

		
		stickmanFigure = new ActorStickmanFigure();
		this.add(stickmanFigure);
		actorNameLabel = new Label("test");
	//	FontData[] fontdata = {new FontData("Arial", 10, SWT.BOLD)};
		actorNameLabel.setFont(ResourceFactory.getHeadFont());
		actorNameLabel.setForegroundColor(ColorConstance.BLACK);
		actorNameLabel.setBackgroundColor(ColorConstance.WHITE);
		this.add(actorNameLabel);

	}


	@Override
	public void setBounds(Rectangle rect) {
		super.setBounds(rect);
		Rectangle bounds = rect.getCopy();
		Dimension labelSize = actorNameLabel.getPreferredSize();
		bounds.height -= labelSize.height + 5;
		stickmanFigure.setBounds(bounds);
	}

	
	 
	public Label getActorNameLabel() {
		return actorNameLabel;
	}


	public void setActorName(String newName) {
		
		this.actorNameLabel.setText(newName);
	}
	
	protected void paintShadow(Graphics g) {
	}

	@Override
	protected void fillShape(Graphics graphics) {

	}

	@Override
	protected void outlineShape(Graphics graphics) {

	}

}
